package com.xsmart.oa.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.oa.services.QueryAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/11/22.
 */
@Controller
@RequestMapping("/api")
public class AdminManageController {

    @Autowired
    QueryAdminService queryAdminService;

    @RequestMapping(value="/v1/queryAdminService/queryAdminList",method = RequestMethod.POST)
    @ResponseBody
    public Object queryAdminList(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return queryAdminService.queryAdminList(requestBean);
    }

    @RequestMapping(value="/v1/queryAdminService/deleteAdmin",method = RequestMethod.POST)
    @ResponseBody
    public Object deleteAdmin(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return queryAdminService.deleteAdmin(requestBean);
    }

    @RequestMapping(value="/v1/queryAdminService/updateAdmin",method = RequestMethod.POST)
    @ResponseBody
    public Object updateAdmin(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return queryAdminService.updateAdmin(requestBean);
    }

    @RequestMapping(value="/v1/queryAdminService/saveAdmin",method = RequestMethod.POST)
    @ResponseBody
    public Object saveAdmin(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return queryAdminService.saveAdmin(requestBean);
    }
}
